package org.hhchat.others.erp;

import java.util.Scanner;

public class Main2 {

    static int mod = 10000;
    static int[][] dp =new int[2005][2005];

    public static void main(String[] args){
        //输入
        Scanner in = new Scanner(System.in);
        init();
        while(in.hasNextInt()){
            int n=in.nextInt();
            int m=in.nextInt();
            System.out.println(dp[n][m]);
        }
    }

    static void init() {
        for (int i = 1; i <= 2000; ++i)
            dp[i][0] = 1;
        for (int i = 2; i <= 2000; ++i) {
            for (int j = 1; j <= i * (i - 1) / 2 && j <= 1000; ++j) {
                dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
                if (j - i >= 0)
                    dp[i][j] -= dp[i - 1][j - i];
                dp[i][j] = (dp[i][j] % mod + mod) % mod;
            }

        }
    }
}